<?php

declare(strict_types=1);

namespace Tool\Database\MockType;

/**
 * 手机号类型.
 */
class VarcharPhone extends Varchar
{
    /**
     * {@inheritDoc}
     */
    protected function mock()
    {
        $len = 11 - (strlen((string) $this->count) + 1);
        $randomNum = mt_rand(1, intval(str_pad('9', $len, '9')));
        $randomNum = str_pad((string) $randomNum, $len, '0');

        return '1'.$randomNum.$this->count;
    }
}
